package cn.bluethink.eguan.module.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;

import cn.bluethink.eguan.model.module.EgModule;

@Table(name = "eg_module")
public class EgModuleEntity {
	@Id
	private Long mid;
	private String name;
	private String icon;
	private String summary;
	private String des;
	private String objurl;
	private String helpurl;
	private Long uid;
	@Column(name = "b_conf")
	private Integer bConf;
	private Date utime;
	private Date ctime;
	@Column(name = "check_status")
	private Integer checkStatus;

	/**
	 * 模型转实体类
	 * 
	 * @param module
	 * @return
	 */
	public EgModuleEntity(EgModule module) {
		this.summary = module.getSummary();
		this.des = module.getDes();
		this.icon = module.getIcon() == null ? "" : module.getIcon();
		this.bConf = module.getbConf() == null ? 0 : module.getbConf();
		this.name = module.getName();
		if (module.getId() != null) {
			this.mid = module.getId();
		}

	}
	
	/**
	 * 实体类转模型
	 * 
	 * @param entity
	 * @return
	 */
	public EgModule createModule(){
		EgModule module = new EgModule();
		module.setId(mid);
		module.setSummary(summary);
		module.setDes(des);
		module.setName(name);
		module.setIcon(icon);
		module.setbConf(bConf);
		return module;
		
	}

	public EgModuleEntity() {
		super();
		// TODO Auto-generated constructor stub
	}

	public Long getMid() {
		return mid;
	}

	public void setMid(Long mid) {
		this.mid = mid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	public String getDes() {
		return des;
	}

	public void setDes(String des) {
		this.des = des;
	}

	public String getObjurl() {
		return objurl;
	}

	public void setObjurl(String objurl) {
		this.objurl = objurl;
	}

	public String getHelpurl() {
		return helpurl;
	}

	public void setHelpurl(String helpurl) {
		this.helpurl = helpurl;
	}

	public Long getUid() {
		return uid;
	}

	public void setUid(Long uid) {
		this.uid = uid;
	}

	public Date getUtime() {
		return utime;
	}

	public void setUtime(Date utime) {
		this.utime = utime;
	}

	public Date getCtime() {
		return ctime;
	}

	public void setCtime(Date ctime) {
		this.ctime = ctime;
	}

	public Integer getbConf() {
		return bConf;
	}

	public void setbConf(Integer bConf) {
		this.bConf = bConf;
	}

	public Integer getCheckStatus() {
		return checkStatus;
	}

	public void setCheckStatus(Integer checkStatus) {
		this.checkStatus = checkStatus;
	}

}
